//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package study.API;

import java.util.Arrays;
import java.util.Comparator;

public class Arrays_demo {
    public Arrays_demo() {
    }

    public static void main(String[] args) {
        int[] arr = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        System.out.println(Arrays.toString(arr));
        System.out.println(Arrays.binarySearch(arr, 0));
        System.out.println(Arrays.binarySearch(arr, 3));
        System.out.println(Arrays.binarySearch(arr, 20));
        System.out.println(Arrays.toString(Arrays.copyOf(arr, 5)));
        System.out.println(Arrays.toString(Arrays.copyOf(arr, 20)));
        System.out.println(Arrays.toString(Arrays.copyOfRange(arr, 3, 7)));
        System.out.println(Arrays.toString(Arrays.copyOfRange(arr, 3, 20)));
        Arrays.fill(arr, 33);
        System.out.println(Arrays.toString(arr));
        int[] arr2 = new int[]{3, 5, 2, 7, 8, 9, 4};
        Arrays.sort(arr2);
        System.out.println(Arrays.toString(arr2));
        Integer[] arr3 = new Integer[]{3, 5, 2, 7, 8, 9, 4, 10, 14, 36};
        Arrays.sort(arr3, new Comparator<Integer>() {
            public int compare(Integer o1, Integer o2) {
                return o1 - o2;
            }
        });
        System.out.println(Arrays.toString(arr3));
        Integer[] arr4 = new Integer[]{3, 5, 2, 7, 8, 9, 4, 10, 14, 36};
        Arrays.sort(arr4, new Comparator<Integer>() {
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });
        System.out.println(Arrays.toString(arr4));
    }
}
